import request from '@/utils/request'
import { isJSON } from '../../utils/utils'

// 查询产业园区列表
export function listPark(query) {
  return request({
    url: '/system/park/list',
    method: 'get',
    params: query
  })
}

// 查询产业园区详细
export function getPark(id) {
  return request({
    url: '/system/park/' + id,
    method: 'get'
  })
}

// 新增产业园区
export function addPark(data) {
  data.parkData = JSON.stringify(data.parkData)
  return request({
    url: '/system/park',
    method: 'post',
    data: data
  })
}

// 修改产业园区
export function updatePark(data) {
  if(!isJSON(data.parkData )){
    data.parkData = JSON.stringify(data.parkData)
  }
  return request({
    url: '/system/park',
    method: 'put',
    data: data
  })
}

// 删除产业园区
export function delPark(id) {
  return request({
    url: '/system/park/' + id,
    method: 'delete'
  })
}
